]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
systemActions: Fix initial visibility of logout action
authorSebastian Keller <skeller@gnome.org>
Fri, 13 Mar 2026 00:27:29 +0000 (01:27 +0100)
committerFlorian Müllner <fmuellner@gnome.org>
Sat, 14 Mar 2026 17:47:44 +0000 (18:47 +0100)
When `_updateLogout()` is called on login, the AccountsService user
might not have been loaded yet. This would have resulted in all values
being null/false, including `local_account`. Since `!localAccount` is
one of the cases where the action is available, this would have wrongly
resulted in the item being shown when not intended to be shown. But only
until something triggers another call of `_updateLogout()`, such as
locking/unlocking the session.

Related: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/9100
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/4121>
(cherry picked from commit 6f5f3c1f18a3597df04f831d4a8e1cdba2c0ecea)

js/misc/systemActions.js

index d0a934d23644dec3367cdfd16f82d853a18b3189..4017fc2a052b7a1394ac850ec1e3e1bcf0ef5c38 100644 (file)
@@ -173,6 +173,10 @@ const SystemActions = GObject.registerClass({
         this._userManager.connect('user-removed',
             () => this._updateMultiUser());
 
+        this._user = this._userManager.get_user(GLib.get_user_name());
+
+        this._user.connect('notify::is-loaded', () => this._updateLogout());
+
         this._lockdownSettings.connect(`changed::${DISABLE_USER_SWITCH_KEY}`,
             () => this._updateSwitchUser());
         this._lockdownSettings.connect(`changed::${DISABLE_LOG_OUT_KEY}`,
@@ -399,12 +403,9 @@ const SystemActions = GObject.registerClass({
     }
 
     _updateLogout() {
-        let user = this._userManager.get_user(GLib.get_user_name());
-
         let allowLogout = !this._lockdownSettings.get_boolean(DISABLE_LOG_OUT_KEY);
         let alwaysShow = global.settings.get_boolean(ALWAYS_SHOW_LOG_OUT_KEY);
-        let systemAccount = user.system_account;
-        let localAccount = user.local_account;
+        let {systemAccount, localAccount} = this._user;
         let multiUser = this._userManager.has_multiple_users;
         let multiSession = Gdm.get_session_ids().length > 1;
         let shouldShowInMode = !Main.sessionMode.isLocked && !Main.sessionMode.isGreeter;